﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;

namespace commodity.Models
{
    public class CommodityInformation
    {
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int id { get; set; }
        [Required]
        [MaxLength(32)]
        public string PropertyName { get; set; }
        public string? Value { get; set; }
        [Required]
        public StateProperty state { get; set; }
        [ForeignKey("CommodityId")]
       public int CommodityId { get; set; }
        public Commodity commodity { get; set; }
        public string[] GetString(string str) 
        {
            if (string.IsNullOrWhiteSpace(str)) 
            {
                return null;
            }
            return str.Split(",");
        }
    }
}
